package com.yuan.java.java.atomic;

import org.junit.Test;

import java.util.concurrent.TimeUnit;

/**
 * @author yuaneg 2019/1/9
 */
public class AtomicTest {


    @Test
    public void aa() throws InterruptedException {
        BarWorker bar1 = new BarWorker("bar1");
        BarWorker bar2 = new BarWorker("bar2");
        new Thread(bar1).start();
        new Thread(bar2).start();
        TimeUnit.SECONDS.sleep(3);
    }

    @Test
    public void bb() throws InterruptedException {
        BarWorker2 bar1 = new BarWorker2("bar1");
        BarWorker2 bar2 = new BarWorker2("bar2");
        new Thread(bar1).start();
        new Thread(bar2).start();
        TimeUnit.SECONDS.sleep(3);
    }

}
